#include "sfc/test.h"

namespace sfc::option {

namespace {

struct Copy {
  void fmt(auto& f) const {
    f.write_str("Copy{}");
  }
};

struct Move {
  Move() {}
  ~Move() {}
  Move(Move&&) {}

  void fmt(auto& f) const {
    f.write_str("Move()");
  }
};

}  // namespace

SFC_TEST(copy) {
  static_assert(__is_trivially_copyable(Option<Copy>));

  auto a = Option{Copy{}};
  auto b = a;
  test::assert_true(a.is_some());
  test::assert_true(b.is_some());
}

SFC_TEST(move) {
  static_assert(!__is_trivially_copyable(Option<Move>));

  auto a = Option{Move{}};
  auto b = mem::move(a);
  test::assert_true(a.is_some());
  test::assert_true(b.is_some());
}

}  // namespace sfc::option
